#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
'''
@author: yuejl
@application:
@contact: lewyuejian@163.com
@file: globalVariableCache.py
@time: 2021/11/15 0015 1:09
@desc: 临时变量
'''

class GlobalVariableCache:
    def __init__(self):
        # 提取响应参数的缓存池
        self.variableCache = {}

    def handle_variable(self):
        pass

    # TODO 1: 判断headers是否在临时变量中\
    # todo 2: 判断headers中的key是否存在临时变量并且不为空
    # todo 3: 判断测试数据的headers中各个key的值是否包含 ${} ，如果包含：则需要替换临时变量的值
    # todo 4: 判断测试数据的headers中各个key的值是否包含 {{}}，如果包含：则优先取临时变量>环境变量>全局变量
    def handle_headers(self, variables):
        if 'headers' in self.variableCache and self.variableCache.get('headers') is None:
            for key, value in variables.get('headers'):
                if key in self.variableCache.get('headers') and self.variableCache.get('headers').get(key) is not None:
                    pass



    def handle_body(self):
        pass



